const App = {
    // mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            Data: [],
            page:{},
            nodeKey:'',
        }
    },
    mounted() {
        let ls_URL = window.location.href;
        this.nodeKey = getQueryObject(ls_URL, "nodeKey");// 获取 nodeKey 参数
        this.nodeKey1 = getQueryObject(ls_URL, "nodeKey1");// 获取 nodeKey 参数
        this.handleShow();
    },
    methods: {
        handleShow() {
            console.log("%" + this.nodeKey1 + "%,%" + this.nodeKey + "%");
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
                method: "post",
                data: {
                    SQLSerialNumber: "t_innovation_practice_annual_summary",
                    Condition: window.btoa(unescape(encodeURIComponent("%" + this.nodeKey1 + "%,%" + this.nodeKey + "%"))),
                },
                success: (res) => {
                    this.Data = res;
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
            });
        },
        personalAdd(row) {
            window.location.href = './addzj.html?action=Add&nodeKey=' + this.nodeKey + '&nodeKey1=' +  this.nodeKey1 
        },
        xinwen(row) {
            window.location.href = '../../news_videos_files/news/add.html?action=Add&News_Category_SerialNumber=NC0000000000075&Party_Organization_Activity_SerialNumber=' + row.Innovation_Practice_Annual_Summary_SerialNumber
        },
        xinwenjilu(row){
            window.location.href = './news.html?nodeKey=' + row.Innovation_Practice_Annual_Summary_SerialNumber
        },
        handleEdit(row) {
            let { primary_key } = JSON.parse(document.getElementById("table").getAttribute("data-options"));
            window.location.href = "./addzj.html?action=Modify&nodeKey=" + row[primary_key];
        },
        //删除数据
        handleDelete(data) {
            this.$confirm('该操作将删除此条数据,是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {
                let { TableName, primary_key } = JSON.parse(document.getElementById("table").getAttribute("data-options"));
                $.ajax({
                    headers: requestHeaders(),
                    url: `${mh}/generalBusiness/generalQueryByTableNameWithOriginal`,
                    method: "post",
                    data: {
                        Data: TableName,
                        Condition: primary_key + "='" + data[primary_key] + "'"
                    },
                    success: (res) => {
                        if (res.length == 1) {
                            res[0].Row_Status = '1';
                            let lJSONObject_DataSet = new Object();
                            let lJSONObject_Table = new Object();
                            lJSONObject_Table[TableName] = res;
                            lJSONObject_DataSet['Modify'] = lJSONObject_Table;
                            let Operation_Main = JSON.stringify(deepClone(lJSONObject_DataSet));
                            lJSONObject_DataSet['Add'] = new Object();
                            lJSONObject_DataSet['Add']['base_operation_log'] = [{
                                Operation_Type: '0',
                                Operation_Path: this.relativePath,
                                Operation_Main,
                                Operation_Interface: "generalSaveByRequestBody",
                                Operation_IP: getIpAddress()
                            }]
                            submitSave(lJSONObject_DataSet, (res) => {
                                if (res.Status == 'success') {
                                    this.postgetList(this.page);
                                } else {
                                    this.$message({
                                        type: 'error',
                                        message: '删除失败'
                                    });
                                }
                            })
                        } else {
                            this.$message({
                                type: 'error',
                                message: '删除失败'
                            });
                        }

                    },
                    complete: (XMLHttpRequest) => {
                        requestPretreatment(XMLHttpRequest)
                    },
                });
            }).catch(() => { });
        },
        goBack() {
            window.history.back();
        },
        reset(){
            window.location.reload();
        }
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
